__author__ = 'tyrion'

from  conf.gloal import *
from src.common.tools.salt import  *


class BaseCreateMonitors:
    def __init__(self, instances):
        self.instances = instances
        return

    def EditMachine(self):
        print("info: base edit machine")
        return

    def CreateMonitors(self):
        print("info: base create monitors")
        return

    def AddToMonitorSvr(self):
        print("info: base add monitors to monitor svr")
        return

    def CreateMachine(self):
        print "info: base create machine"
        return

    def DeleteMachine(self):
        print("info: base delete machine")
        return

    def ReloadConf(self, icingaSvr = ICINGA_SERVER, saltMaster = SALT_MASTER_IP):
        print("info: reload monitor config icingaSvr=%s,saltMaster=%s "%(icingaSvr, saltMaster))
        cmdO = "cmk -O"
        cmdORet = ExecuteCommand(icingaSvr, cmdO, saltMaster)
        cmdOErrMsg = "cmk - O failed"
        cmdOStatus = AnalyseResult(cmdORet, cmdOErrMsg, icingaSvr)
        if cmdOStatus == "false":
            return

        return 200

    # def NotifyMonitorSvr(self):
    #     print("info: base notify monitor svr to reload config")
    #     return